#!/usr/bin/env bash

############################################################################
#
# 远程执行该脚本，请在命令行中直接执行以下命令：
#
#   curl -sSL https://gitee.com/tay3223/biubiubiu/raw/master/centos7-install-nvm.sh | /bin/bash
#
#
############################################################################

git clone -b v0.39.1 https://gitee.com/tay3223/nvm.git ~/nvm

echo "source ~/nvm/nvm.sh" >> ~/.bashrc

cat >>  ~/.bashrc << \EOF

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

EOF

source ~/.bashrc

#Example:
#  nvm install 8.0.0                     Install a specific version number
#  nvm use 8.0                           Use the latest available 8.0.x release
#  nvm run 6.10.3 app.js                 Run app.js using node 6.10.3
#  nvm exec 4.8.3 node app.js            Run `node app.js` with the PATH pointing to node 4.8.3
#  nvm alias default 8.1.0               Set default node version on a shell
#  nvm alias default node                Always default to the latest available node version on a shell
#
#  nvm install node                      Install the latest available version
#  nvm use node                          Use the latest version
#  nvm install --lts                     Install the latest LTS version
#  nvm use --lts                         Use the latest LTS version
#
#  nvm set-colors cgYmW                  Set text colors to cyan, green, bold yellow, magenta, and white
#
#Note:
#  to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)
